package com.qiwx.pigeon.activity.home;

import com.qiwx.pigeon.activity.query.WXDCageActivity;
import com.qiwx.pigeon.activity.stock.StockManagerActivity;
import com.qiwx.pigeon.activity.summary.SummaryHomeActivity;
import com.qiwx.pigeon.data.vo.HomeRemindBean;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import okhttp3.Interceptor;

/**
 * @description
 * @Author qiwx
 * @Date 2020-04-05 13:46
 * 首页帮助类
 **/
public class HomeHelper {
    public static List<HomeRemindBean> list;

    public static final int REMIND_CXPD = 0;
    public static final int REMIND_GZTW = 1;
    public static final int REMIND_DWXSX = 2;
    public static final int REMIND_CDTX = 3;
    public static final int REMIND_CKTX = 4;
    public static final int REMIND_ZGTT = 5;
    public static final int REMIND_FHX = 6;
    public static final int REMIND_SCSJTJ = 7;
    public static final int REMIND_JXC = 8;
    public static final int REMIND_GCSJFX = 9;
    public static final int REMIND_RGZN = 10;
    public static final int REMIND_CYDSJ = 11;
    public static final int REMIND_WXD = 12;
    static String[][] configs = new String[][]{
            {"重新配对", String.valueOf(REMIND_CXPD), PigeonPairActivity.class.getName()},
            {"鸽崽调窝", String.valueOf(REMIND_GZTW), null},
            {"待维修事项", String.valueOf(REMIND_DWXSX), CageRepairActivity.class.getName()},
            {"查蛋提醒", String.valueOf(REMIND_CDTX), null},
            {"出壳提醒", String.valueOf(REMIND_CKTX), null},
            {"种鸽淘汰", String.valueOf(REMIND_ZGTT), EliminateActivity.class.getName()},
            {"孵化箱", String.valueOf(REMIND_FHX), null},
            {"生产数据统计", String.valueOf(REMIND_SCSJTJ), SummaryHomeActivity.class.getName()},
            {"进销存", String.valueOf(REMIND_JXC), StockManagerActivity.class.getName()},
            {"鸽场数据分析", String.valueOf(REMIND_GCSJFX), null},
            {"人工智能", String.valueOf(REMIND_RGZN), null},
            {"产业大数据", String.valueOf(REMIND_CYDSJ), null},
            {"未下蛋", String.valueOf(REMIND_WXD), WXDCageActivity.class.getName()},
    };

    public static List<HomeRemindBean> getRemindList() {
        if (list == null) {
            list = new ArrayList<>();
            for (int i = 0; i < configs.length; i++) {
                HomeRemindBean bean = new HomeRemindBean();
                bean.setName(configs[i][0]);
                bean.setType(Integer.parseInt(configs[i][1]));
                bean.setCl(getClassFromName(configs[i][2]));
                list.add(bean);
            }
        }
        return list;
    }

    private static Class getClassFromName(String name) {
        if (name == null)
            return null;
        try {
            Class cl = Class.forName(name);
            return cl;
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
        return null;

    }
}
